using Microsoft.Practices.Composite.Events;
using StockholmsStad.Windows.UI.Modules.Minister.Interfaces;
using StockholmsStad.Windows.UI.Modules.Minister.Models;

namespace StockholmsStad.Windows.UI.Modules.Minister.Presenters
{
    public class MinisterPresenter
    {
        private readonly IMinisterListPresenter listPresenter;
        private readonly IMinisterController couplesController;

        public MinisterPresenter(
            IMinisterView view,
            IMinisterListPresenter listPresenter, IMinisterController ministerController)
        {
            View = view;
            this.listPresenter = listPresenter;
            couplesController = ministerController;
            this.listPresenter.MinisterSelected += listPresenter_MinisterSelected;

            View.SetContent(listPresenter.View);
        }

        void listPresenter_MinisterSelected(object sender, DataEventArgs<MinisterPresentationModel> e)
        {
            couplesController.OnMinisterSelected(e.Value);
        }

        public IMinisterView View { get; set; }
    }
}
